<template>
  <view class="setting-main">
    <uni-list class="">
      <uni-list-item
        title="修改密码"
        thumb="../../static/img/svg/safe.svg"
        @click="toEditPassword"
    /></uni-list>
    <view class="uni-btn-v">
      <button form-type="submit" @click="logout">退出登录</button>
    </view>
  </view>
</template>

<script>
import store from "../../store/index.js";
export default {
  data() {
    return {};
  },
  components: {},
  mounted() {},
  methods: {
    async logout() {
      let res = await this.$api.logout({
        access_token: store.getters.getToken.split(" ")[1],
      });
      this.$store.commit("setToken", "Basic Y2xpZW50OjEyMzQ1Ng==");
      uni.navigateTo({
        url: "/pages/user/login",
      });
    },
    toEditPassword() {
      uni.navigateTo({
        url: "/pages/user/editPassword",
      });
    },
  },
};
</script>

<style lang="less" scope>
@import "@/static/less/flex.less";

uni-page-body {
  height: 100%;
}
.setting-main {
  height: 100%;
  width: 100%;
  background: #fff;
  padding: 0 0 30upx 0;

  .uni-list-item {
    padding-left: 0;
    border-bottom: 1upx solid #e5e5e5;

    /deep/.uni-list-item__icon-img {
      margin-left: 10upx;
    }
  }

  .uni-btn-v {
    padding: 30upx;
    position: fixed;
    left: 0;
    bottom: 0;
    right: 0;
    margin: auto;
  }
}
</style>
